﻿using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Design;
using System.Windows.Forms.Design;
using System.Xml.Serialization;
using Landpy.CruiseControlNet.Infrastructure.Control;
using System;

namespace Landpy.CruiseControlNet.FacadeInterface.ConfigurationModule
{
    public class NUnit : Task
    {
        [Category("Basic")]
        [Description(@"Path of nunit-console.exe application. (E.g: C:\Program Files (x86)\NUnit 2.5.10\bin\net-2.0\nunit-console.exe)")]
        [XmlElement("path")]
        [Editor(typeof(FileNameEditor), typeof(UITypeEditor))]
        public string Path { get; set; }

        [Category("Basic")]
        [Description("Description used for the visualisation of the buildstage, if left empty the process name will be shown.")]
        [XmlElement("description")]
        public string Description { get; set; }

        [Category("Basic")]
        [Description("The priority class of the spawned process.")]
        [XmlElement("priority")]
        public PriorityType Priority { get; set; }

        [Category("Basic")]
        [Description("Number of seconds to wait before assuming that the process has hung and should be killed.")]
        [DefaultValue(600)]
        [XmlElement("timeout")]
        public int Timeout { get; set; }

        [Editor(typeof(MultipleTypeCollectionEditor), typeof(UITypeEditor))]
        [Category("Basic")]
        [Description("List of the paths to the assemblies containing the NUnit tests to be run.")]
        [XmlArray("assemblies")]
        [XmlArrayItem("assembly")]
        public List<Assembly> Assemblies { get; set; }

        public NUnit()
            : base(TaskType.NUnit)
        {
            this.Assemblies = new List<Assembly>();
            this.Path = String.Empty;
            this.Timeout = 600;
        }
    }
}